package duixiangleixin;

import org.junit.Test;

import java.math.BigDecimal;

/**
 * @Auther lujieni
 * @Date 2020/6/23
 */
public class TestCompareTo {

    /**
     * BigDecimal的操作都需要用新对象来接
     */
    @Test
    public void test(){
        System.out.println(check("Y1A1"));
    }

    private boolean check(String input){
        String begin = "Y1A0A0";
        String end = "Y1A7Z9";
        if(input.compareTo(begin) >= 0 && input.compareTo(end) <= 0){
            return true;
        }else{
            return false;
        }
    }


    public static void main(String[] args) {
        String begin = "Y1A0A0";
        String end = "Y1A7Z9";
        String zipCode = "Y1A7Z1";
        if (zipCode.compareTo(begin) >= 0 && zipCode.compareTo(end) <= 0) {
            System.out.println(true);
        } else {
            System.out.println(false);
        }
    }

}
